public class Test {
    public ListNode FindKthToTail (ListNode pHead, int k) {
        // write code here
        if(pHead == null) {
            return null;
        }

        if(k <= 0 ) {
            return null;
        }

        int count = k-1;
        ListNode fast = pHead;
        ListNode slow = pHead;

        while(count != 0) {
            fast = fast.next;
            if(fast == null) {
                return null;
            }
            count--;
        }

        while(fast.next != null) {
            fast = fast.next;
            slow = slow.next;
        }
        return slow;
    }
    public ListNode FindKthToTail (ListNode pHead, int k) {
        // write code here
        if(pHead == null) {
            return null;
        }

        if(k <= 0 ) {
            return null;
        }

        int count = k-1;
        ListNode fast = pHead;
        ListNode slow = pHead;

        while(count != 0) {
            fast = fast.next;
            if(fast == null) {
                return null;
            }
            count--;
        }

        while(fast.next != null) {
            fast = fast.next;
            slow = slow.next;
        }
        return slow;
    }
}
